#!/bin/sh
#
# /etc/rc.d/rc.openvasmd
#
# Start/stop/restart the OpenVAS Manager Daemon.
#
# To make OpenVAS Manager start automatically at boot, make this
# file executable:  chmod 755 /etc/rc.d/rc.openvasmd
# and add to rc.local:
# if [ -x /etc/rc.d/rc.openvasmd ]; then
#   . /etc/rc.d/rc.openvasmd start
# fi
#

OPENVASMD_PATH=/usr/sbin
OPENVASMD_BIN=openvasmd
OPENVASMD_OPTIONS="-a 127.0.0.1 --gnutls-priorities=SECURE128:-VERS-SSL3.0"
OPENVASMD_CMD="$OPENVASMD_PATH/$OPENVASMD_BIN $OPENVASMD_OPTIONS"

openvasmd_start() {
  echo Starting OpenVAS Manager: $OPENVASMD_CMD
  $OPENVASMD_CMD
}

openvasmd_stop() {
  echo "Stopping OpenVAS Manager"
  /bin/killall $OPENVASMD_BIN
}

openvasmd_restart() {
  openvasmd_stop
  openvasmd_start
}

case "$1" in
'start')
  openvasmd_start
  ;;
'stop')
  openvasmd_stop
  ;;
'restart')
  openvasmd_restart
  ;;
*)
  echo "usage $0 start|stop|restart|reload"
esac
